﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.SharePoint;
using System.Globalization;

namespace NumberToTextField
{
    class Factory
    {

        public static NumbertoTextBase createinstance() 
        {
            //string CurrentCulture = System.Threading.Thread.CurrentThread.CurrentUICulture.ToString();

            LanguageManager LANGManager = new LanguageManager(System.Threading.Thread.CurrentThread.CurrentUICulture);

            NumbertoTextBase ns = (NumbertoTextBase)System.Reflection.Assembly.GetExecutingAssembly().CreateInstance(LANGManager.GetLocalizedString("ClassName"));

            return ns;
            
               
        }

        public static NumbertoTextBase createinstance(CultureInfo locale)
        {
           
            LanguageManager LANGManager = new LanguageManager(locale);

            NumbertoTextBase ns = (NumbertoTextBase)System.Reflection.Assembly.GetExecutingAssembly().CreateInstance(LANGManager.GetLocalizedString("ClassName"));
            ns.setLocale(locale);
            return ns;


        }

    }
}
